<%-- 
    Document   : ViewExercises
    Created on : 08.02.2011, 15:44:47
    Author     : eric
--%>

<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.lang.*" %>
<%@ include file="header.jsp" %>
<div id="contents">
    <h1>vorhandene Übungen:</h1>
    <div style="text-align: center;">
        <%@ include file="exercisePagination.jsp" %>
    </div>
    <br/>
    <%
        // Initialisieren exercises
        String[][] exercises = null;

        // Wenn Parameter order, direction und limit null sind
        if(request.getParameter("limit") != null){
            // Trainingspläne geordnet auslesen
            exercises = db.exercises.getAllExercisesOrdered(request.getParameter("limit"), session.getAttribute("typeofsport").toString());
        } else {
            // Trainingspläne geordnet auslesen
            exercises = db.exercises.getAllExercisesOrdered(null, session.getAttribute("typeofsport").toString());
        }

        // Für jede Übung eine HTML-Tabelle erzeugen ...
        for(String[] exercise: exercises){
            out.print("<p>" + db.exercises.getExerciseHtmlViewById(exercise[0]) + "</p>");
        }
    %>
    <div style="text-align: center;">
        <%@ include file="exercisePagination.jsp" %>
    </div>
</div>
                
<%@ include file="footer.jsp" %>